﻿#region Using Statements
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
#endregion

namespace RhinoXNA.RhinoGraphics.Rhino2D
{
    public class FontEntity : IRhinoDrawable
    {
        protected SpriteFont _font;
        protected string _text;

        public FontEntity(SpriteBatch sBatch, SpriteFont font, string text, Vector2 pos, float rot, Vector2 scale)
            :base(sBatch)
        {
            _font = font;
            _text = text;
            this.Position = pos;
            this.Rotation = rot;
            this.Scale = scale;
        }

        public override void Initialize(string fileToLoad)
        {

        }

        public override void Update(GameTime gameTime)
        {
        
        }

        public override void Render()
        {
            _sBatch.Begin();
            // Find the center of the string
            Vector2 FontOrigin = _font.MeasureString(_text) / 2;
            // Draw the string
            this._sBatch.DrawString(_font, _text, this.Position, Color.Black,
                this.Rotation, FontOrigin, this.Scale, SpriteEffects.None, this.Layer);
            _sBatch.End();
        }


    }
}
